<include file="public/header"/>
<div class="am-cf admin-main">
<!-- sidebar start -->
<include file="public/sidebar"/>
<!-- sidebar end -->

<!-- content start -->
<div class="admin-content">
<div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">
        收款列表
        <a id="getValue">
            <button type="button" class="am-btn am-btn-success am-btn-xs">
                批量订金操作
            </button>
        </a>
    </strong></div>
    <div id="result">{$desc}</div>
</div>

<div class="am-g">
    <div class="am-u-md-6 am-cf">
        <div class="am-fl am-cf">
            <div class="am-btn-toolbar am-fl">
                <div class="am-btn-group am-btn-group-xs">

                    <form method="post" action="__URL__/collectionListExport">
                        <input type="text" name="start_time" placeholder="选择日期" data-am-datepicker readonly/>
                        <input type="text" name="end_time" placeholder="选择日期" data-am-datepicker readonly/>

                        <button type="submit" class="am-btn-primary am-btn-xs">
                            导出excel
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--搜索-->
    <form method="post" action="__URL__/../Search/collectionSearch" class="am-form">
        <div class="am-form-group am-margin-left am-fl">
            <select name="select">
                <option value="name">姓名</option>
                <option value="ordernum">订单号</option>
            </select>
        </div>
        <div class="am-u-md-3 am-cf">
            <div class="am-fr">
                <div class="am-input-group am-input-group-sm">
                    <input type="text" class="am-form-field" name="ifin" id="ifin">
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" type="submit">搜索</button>
                </span>
                </div>
            </div>
        </div>
    </form>
    <!--end-->
</div>

<div class="am-g">
    <div class="am-u-sm-12">
        <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
            <tr>
                <th class="table-check"><input type="checkbox" id="all"/></th>
                <th class="table-type">日期</th>
                <th class="table-type">姓名</th>
                <th class="table-type">订单号</th>
                <th class="table-type">明细</th>
                <th class="table-id">件数</th>
                <th class="table-type">总额</th>
                <th class="table-type">订金</th>
                <th class="table-type">收款人</th>
                <th class="table-type">日期</th>
                <th class="table-type">方式</th>
                <th class="table-type">余额</th>
                <th class="table-type">收款人</th>
                <th class="table-type">日期</th>
                <th class="table-type">方式</th>
                <th class="table-set">操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="datas" item="data">
                <tr>
                    <td><input type="checkbox" name="omid[]" class="check" value="{$data.omid}"/></td>
                    <td>{$data.gc_updated|date="Y-m-d",###}</td>
                    <td>{$data.name}</td>
                    <td>
                        {$data.ordernum}
                    </td>
                    <td>{$data.type}</td>
                    <td>{$data.num}</td>
                    <td>{$data.price_count}</td>
                    <td>{$data.dj_count}</td>
                    <td>{$data.dj_ren}</td>
                    <td>{$data.dj_updated}</td>
                    <td>{$data.dj_type}</td>
                    <td>{$data.balance}</td>
                    <td>{$data.ba_ren}</td>
                    <td>{$data.ba_updated}</td>
                    <td>{$data.ba_type}</td>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <a href="#" data-am-modal=
                                        "{target: '#{$data.omid}', closeViaDimmer: 0, width: 400, height: 225}">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-primary">
                                        <span class="am-icon-pencil-square-o"></span>
                                        订金
                                    </button>
                                </a>
                                <!--弹出框-->
                                <div class="am-modal am-modal-no-btn" tabindex="-1" id="{$data.omid}">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd">订金支付方式
                                            <a href="javascript: void(0)" class="am-close am-close-spin"
                                               data-am-modal-close>&times;</a>
                                        </div>
                                        <div class="am-modal-bd">
                                            <form class="am-form" method="post" action="__URL__/djPay">
                                                <div class="am-form-group">
                                                    <input class="am-form-field" placeholder="订金收款人" name="dj_ren"/>
                                                </div>
                                                <div class="am-form-group">
                                                    <input class="am-form-field" placeholder="收取日期" name="dj_updated"
                                                           data-am-datepicker
                                                           readonly/>
                                                </div>
                                                <div class="am-form-group">
                                                    <select data-am-selected name="dj_type">
                                                        <option value="现金">现金</option>
                                                        <option value="老王">老王</option>
                                                        <option value="微信">微信</option>
                                                    </select>
                                                </div>
                                                <input type="hidden" name="omid" value="{$data.omid}"/>
                                                <input type="hidden" name="price" value="{$data.price_count}"/>
                                                <input type="hidden" name="dj" value="{$data.dj_count}"/>
                                                <input type="hidden" name="balance" value="{$data.balance}"/>
                                                <button type="submit" class="am-btn am-btn-success am-text-success">提交
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <!--end-->
                                <a href="#" data-am-modal=
                                        "{target: '#{$data.omid}2', closeViaDimmer: 0, width: 400, height: 225}">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                        <span class="am-icon-pencil-square-o"></span>
                                        余款
                                    </button>
                                </a>
                                <!--弹出框2-->
                                <div class="am-modal am-modal-no-btn" tabindex="-1" id="{$data.omid}2">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd">余款支付方式
                                            <a href="javascript: void(0)" class="am-close am-close-spin"
                                               data-am-modal-close>&times;</a>
                                        </div>
                                        <div class="am-modal-bd">
                                            <form class="am-form" method="post" action="__URL__/balancePay">
                                                <div class="am-form-group">
                                                    <input class="am-form-field" placeholder="余款收款人" name="ba_ren"/>
                                                </div>
                                                <div class="am-form-group">
                                                    <input class="am-form-field" placeholder="收取日期" name="ba_updated"
                                                           data-am-datepicker
                                                           readonly/>
                                                </div>
                                                <div class="am-form-group">
                                                    <select data-am-selected name="ba_type">
                                                        <option value="现金">现金</option>
                                                        <option value="老王">老王</option>
                                                        <option value="微信">微信</option>
                                                    </select>
                                                </div>
                                                <input type="hidden" name="omid" value="{$data.omid}"/>
                                                <input type="hidden" name="price" value="{$data.price_count}"/>
                                                <input type="hidden" name="dj" value="{$data.dj_count}"/>
                                                <input type="hidden" name="balance" value="{$data.balance}"/>
                                                <button type="submit" class="am-btn am-btn-success am-text-success">提交
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <!--end-->
                                <a href="#" data-am-modal=
                                        "{target: '#{$data.omid}3', closeViaDimmer: 0, width: 400, height: 225}">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-success">
                                        <span class="am-icon-pencil-square-o"></span>
                                        修改
                                    </button>
                                </a>
                                <!--弹出框3-->
                                <div class="am-modal am-modal-no-btn" tabindex="-1" id="{$data.omid}3">
                                    <div class="am-modal-dialog">
                                        <div class="am-modal-hd">修改金额
                                            <a href="javascript: void(0)" class="am-close am-close-spin"
                                               data-am-modal-close>&times;</a>
                                        </div>
                                        <div class="am-modal-bd">
                                            <form class="am-form" method="post" action="__URL__/moneyEdit">
                                                <div class="am-form-group">
                                                    <input class="am-form-field" placeholder="总额" name="price_count"/>
                                                </div>

                                                <input type="hidden" name="omid" value="{$data.omid}"/>
                                                <button type="submit" class="am-btn am-btn-success am-text-success">提交
                                                </button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                                <!--end-->
                            </div>
                        </div>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="am-cf">
            {$page}
        </div>
    </div>
</div>
</div>
<!-- content end -->
</div>
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
    $("#all").click(function () {
        if (this.checked) {
            $(".check").attr("checked", true);
        } else {
            $(".check").attr("checked", false);
        }
    });

    //    批量订金操作ajax
    $("#getValue").click(function () {
        var arr = new Array;
        $("input[name='omid[]']:checked").each(function () {
            arr.push($(this).val());
        });
        $.post(
                "http://001.hitailor.com/Batch/batchGet",
                {"omids": arr},
                function (data) {
                    window.location.href = "http://001.hitailor.com/Batch/batchBelongGc/ids/" + data.content;
                }
        );
    });
</script>
<include file="public/footer"/>